/**
 * 微信验证
 *
 *
 */

import wxconfig from "../../Package/wxconfig";
import sha1 from 'sha1'

export default class AuthCheck {

    constructor() {
       // global['bean']['NodeHttpRequest'].getAxios().get()
    }

    //验证
    check(timestamp, nonce, echostr, signature) {
        return new Promise((resolve, reject) => {
            const str = [timestamp, nonce, wxconfig.token || ''].sort().join('');
            if(sha1(str) === signature){
                resolve(echostr)
            }else{
                resolve("failed")
            }
        })
    }


}
